<?php
/**
* @copyright 2014
*/
include_once '../util/conexion.inc';

if(isset($_POST['params']) && ($_POST['params'] != '')){
	$gParams = (base64_decode(str_replace('~', '=', trim(strval($_POST['params'])))));
	$gParams = (explode('::', trim(strval($gParams))));
}else{
	$gParams = NULL;
}

if(isset($_POST['step']) && ($_POST['step'] != '')){
	if($_POST['step'] == 1){
		$sql = "SELECT id,nombre FROM medicamento ORDER BY nombre";//AND medicamentoEstado=1
		$query = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($query) > 0){
			while($data = mysql_fetch_array($query)){
				echo '<option value="'.$data['id'].'"> '.utf8_encode($data['nombre']).' </option>';
			}
		}
	}elseif($_POST['step'] == 2){
		$sql = "SELECT id,padecimiento FROM padecimientos ORDER BY padecimiento";
		$query = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($query) > 0){
			while($data = mysql_fetch_array($query)){
				echo '<option value="'.$data['id'].'"> '.utf8_encode($data['padecimiento']).' </option>';
			}
		}
	}elseif($_POST['step'] == 3){
		$sql = "SELECT idEnfermedad,nombreEnfermedad FROM enfermedad ORDER BY nombreEnfermedad";
		$query = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($query) > 0){
			while($data = mysql_fetch_array($query)){
				echo '<option value="'.$data['idEnfermedad'].'"> '.utf8_encode($data['nombreEnfermedad']).' </option>';
			}
		}
	}else{
		echo 'No definido!!!!';
		#Aqui se puede segir agregando mas Pasos
	}
}
?>